﻿CREATE TABLE [dbo].[Adrese] (
    [IDAdresa]     INT           IDENTITY (1, 1) NOT NULL,
    [IDJudet]      INT           NULL,
    [IDLocalitati] INT           NULL,
    [Strada]       VARCHAR (100) NULL,
    [Numar]        VARCHAR (20)  NULL,
    [Bloc]         VARCHAR (20)  NULL,
    [Scara]        VARCHAR (20)  NULL,
    [Apartament]   VARCHAR (20)  NULL,
    [IDTara]       INT           NULL,
    [Observatii]   VARCHAR (150) NULL,
    [IDPartener]   BIGINT        NULL,
    [CodPostal]    VARCHAR (6)   NULL,
    [IDTipAdresa]  SMALLINT      NULL,
    [Telefon]      VARCHAR (50)  NULL,
    [Fax]          VARCHAR (50)  NULL,
    CONSTRAINT [PK_Adrese] PRIMARY KEY CLUSTERED ([IDAdresa] ASC),
    CONSTRAINT [FK_Adrese_Judete] FOREIGN KEY ([IDJudet]) REFERENCES [dbo].[Judete] ([IDJudet]),
    CONSTRAINT [FK_Adrese_Localitati] FOREIGN KEY ([IDLocalitati]) REFERENCES [dbo].[Localitati] ([IDLocalitate]),
    CONSTRAINT [FK_Adrese_Parteneri] FOREIGN KEY ([IDPartener]) REFERENCES [dbo].[Parteneri] ([IDPartener]),
    CONSTRAINT [FK_Adrese_Tari] FOREIGN KEY ([IDTara]) REFERENCES [dbo].[Tari] ([IDTara])
);

